{extend name="public:base"}
{block name="body"}
<style>
    .layui-text {line-height: 2.6;}
</style>
<body class="pear-container">
	<div class="layui-card">
        <div class="layui-card-header">配置参数</div>
        <div class="layui-card-body">
            <form class="layui-form layui-form-pane" action="">
                {volist name="config" id="vo"}
                    <div class="pear-row pear-col-space10">
                        <div class="pear-col pear-col-md2 layui-text">{$vo.title}</div>
                        <div class="pear-col pear-col-md20">
                            {eq name="vo.type" value="input"}
                            <input type="text" name="{$vo.name}" value="{$vo.value|default=''}" autocomplete="off"
                                placeholder="" class="layui-input">
                            {else/} 
                            <textarea name="{$vo.name}" class="layui-textarea" style="min-height:400px">{$vo.value|default=''}</textarea>
                            {/eq}
                        </div>
                        <div class="pear-col pear-col-md2 layui-text layui-text-em">{$vo.tips|default='&nbsp;'}</div>
                    </div>
                {/volist}
                <div class="pear-row pear-col-space10">
                    <div class="pear-col pear-col-lg-offset2 ">
                        <button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit="" lay-filter="form-save">
                            <i class="layui-icon layui-icon-ok"></i> 提交
                        </button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</body>
{/block} 
{block name="custom"}{/block}
{block name="script"}
<script>
    layui.use(['form','jquery','element','select'], function() {
        let form = layui.form;
        let $ = layui.jquery;
        let select = layui.select;
        form.on('submit(form-save)', function(data) {
            $.ajax({
                url: '{:url("site")}',
                data: JSON.stringify(data.field),
                dataType: 'json',
                contentType: 'application/json',
                type: 'post',
                success: function(result) {
                    if (result.code == '1') {
                        layer.msg(result.msg, {
                            icon: 1,
                            time: 1000
                        });
                    } else {
                        layer.msg(result.msg, {
                            icon: 2,
                            time: 1000
                        });
                    }
                }
            })
            return false;
        });
    })
</script>
{/block}